package com.iweb.entity;

public class Cat extends Pet{
    private String color;

    @Override
    public void show() {
        super.show();
        System.out.println("颜色:"+color);
    }

    @Override
    public boolean play() {
        if (this.health < 17){     //先判断能否进行一次游戏
            System.out.println(this.nickName+"已经疲惫了，不能继续玩游戏了");
            return false;
        }
        System.out.println(this.nickName+"正在和主人玩抓球球的游戏，健康值-17，亲密度+17");
        this.health -= 17;
        this.love += 17;
        if (this.love > 130){        //判断亲密度是否达到升级要求
            this.level += 1;
            this.love -= 130;
            System.out.println("恭喜您，您的宠物"+this.nickName+"升级了，当前等级："+this.level);

        }
        return true;
    }

    @Override
    public boolean eat() {
        if(this.health == 100){           //判断宠物猫是否吃饱，已吃饱就不能继续喂食
            System.out.println(this.nickName+"已经吃饱了");
            return false;
        }
        System.out.println(this.nickName+"吃了一条海鱼，健康值+45");
        this.health += 45;
        this.health = this.health>100?100:this.health;    //判断健康值是否大于100，大于100，健康值置为100，小于100，健康值为原来的健康值+45
        return true;
    }

    public Cat() {
    }

    public Cat(String nickName, int health, int love, int level, String color) {
        super(nickName, health, love, level);
        this.color = color;
    }

    public String getColor() {
        return color;
    }

    public void setColor(String color) {
        this.color = color;
    }

}
